#/bin/bash

cd `pwd`


ls -1| while read i; do 
	if [[ -d "$i" ]]; then
		echo cd $i
		cd "$i" 
		##  空格应对
		ls -1| while read j; do 
			if [[ -d "$j" ]]; then
				#statements
				echo zip $i/$j
				zip -q -r "$j.zip"  "$j"
				if [[ -f $j.zip ]]; then
					echo  rm $i/$j
					rm -rf "$j"
				fi
			fi
		done
		cd ..
	fi
done
